package com.se.etf.view

import android.content.Context
import android.util.AttributeSet
import android.widget.TextClock
import java.util.*
/**
 * @author Jake Han
 */
class JakeDate :TextClock{
    constructor(context: Context) : super(context){
        setLocaleDateFormat()
    }

    constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet){
        setLocaleDateFormat()
    }

    constructor(context: Context, attributeSet: AttributeSet, i: Int) : super(context, attributeSet, i){
        setLocaleDateFormat()
    }

    private fun setLocaleDateFormat() {
        val currentLocale = Locale("en")
        val cal = Calendar.getInstance(TimeZone.getDefault(), currentLocale)
        val dayName = cal.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.SHORT,currentLocale)
        val monthName = cal.getDisplayName(Calendar.MONTH, Calendar.LONG,currentLocale)
        this.format24Hour = "'$dayName','$monthName' dd,yyyy"
        this.format12Hour = null
    }
}